package com.jeesite.modules.kj.api.vo.response;

import com.jeesite.modules.kj.api.vo.response.base.BaseResponseVo;
import com.jeesite.modules.kj.entity.KjMemberIntegralHistory;
import com.jeesite.modules.kj.enums.IntegralEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.math.BigDecimal;
import java.util.Date;

@Data
public class IntegralHistoryResponseVo extends BaseResponseVo<KjMemberIntegralHistory> {

    @ApiModelProperty(value = "积分ID")
    private String id;
    @ApiModelProperty(value = "用户ID")
    private String memberId;
    @ApiModelProperty(value = "用户名")
    private String memberName;
    @ApiModelProperty(value = "头像")
    private String headimg;

    @ApiModelProperty(value = "积分描述")
    private String remarks;

    @ApiModelProperty(value = "积分")
    private BigDecimal integral;
    @ApiModelProperty(value = "积分类型名")
    private String integralsTypeName;

    @ApiModelProperty(value = "获得时间")
    private Date createDate;

    public IntegralHistoryResponseVo() {
    }

    @Override
    public void setEntity(KjMemberIntegralHistory entity) {
        BeanUtils.copyProperties(entity, this);
        this.memberId = entity.getKjMember().getId();
        this.memberName = entity.getKjMember().getName();
        this.headimg = entity.getKjMember().getHeadimg();
        this.integralsTypeName = IntegralEnum.valueOf(entity.getIntegralType()).getName();
    }

    public IntegralHistoryResponseVo(KjMemberIntegralHistory entity) {
        setEntity(entity);
    }
}
